﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Security.Application;
using ThreeDPrinting.ORM;
using System.Web.Mail;
using SMTP.Utilities;
using ThreeDPrinting.Utilities;
using System.Web.Resources;

namespace ThreeDPrinting.Pages.LogIn
{
    public partial class ForgotPassword : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnReqPass_Click(object sender, EventArgs e)
        {
            using (DBEntities entities = new DBEntities())
            {
                tblmember mem = new tblmember();
                string email = txtEmail.Text;
                mem = entities.tblmembers.SingleOrDefault(p => p.memberEmail == email);
                if (mem != null)
                {
                    string username = "Username:" + mem.memberUserName;
                    string password = "Password:" + mem.memberPassword;
                    MailHelper.SendMailMessage("account@digireal.com", email, null, null, "Digi-Real Account Information", username + "  " + password);
                    lblConfirmPassword.Text = "Your Password has been sent to your e-mail";
                }
                else
                {
                    lblConfirmPassword.Text = "Please enter a Valid E-mail";
                }
            }
        }
    }
}